﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
        Action=Request.QueryString("Action")
        urls=Request.QueryString("urls")
        nid=Request.QueryString("nid")
	if nid="" then nid=1
	if not isnumeric(nid) then nid=1
	nid=clng(nid)
        fansid=Request("fansid")
	if fansid="" then fansid=1
	if not isnumeric(fansid) then fansid=1
	fansid=clng(fansid)

if fansid=qingtian.nid then 
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
qingtian.err("本系统不准许自己送礼给自己")
end if
        if urls="" then urls="index.asp"
        if Action="" then Action="pay4"
        qingtian.info

if sid<>"Null" then
tid=qingtian.nid
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql1 = "select [name],[zmeili],[tupic] from [qingtian_shangpin] where [nid]="&nid
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                name1=rs("name")
                zmeili=rs("zmeili")
                topic=rs("tupic")
                else
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
                qingtian.err("你没有该礼物")
			end if
			Rs.close
Sql2 = "select [name],[meili] from [qingtian_user] where [id]="&fansid
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                name2=rs("name")
                meili=rs("meili")
                else
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
                qingtian.err("该会员不存在")
			end if
			Rs.close
Sql2 = "select [page],[lib] from [qingtian_chuwu] where [nid]="&nid&" and [bid]="&tid
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                pag=rs("page")
                lib=rs("lib")
                if lib=2 then
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
                qingtian.err("你没有该礼物")
                end if
			end if
			Rs.close
                        set rs=nothing
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
if pag=0 then
Response.Redirect "/user/chuwu.asp?act=1&sid="&sidd
end if
select case v
case "0" 
we0="<br/>"
hr="-------------------<br/>"
book2="<input name='fansid' format='*N' size='15' maxlength='50'/><br/><anchor>[确认提交]<go href='songli.asp?Action=pay1&amp;nid="&nid&"&amp;sid="&sidd&"' method='post'><postfield name=""fansid"" value=""$(fansid:n)"" /></go></anchor><br/>"
book="<input name='page' format='*N' size='4' maxlength='5'/>个<anchor>提交<go href='songli.asp?Action=pay2&amp;fansid="&fansid&"&amp;nid="&nid&"&amp;sid="&sidd&"' method='post'><postfield name=""page"" value=""$(page:n)"" /></go></anchor><br/>"
book1="赠送留言:<br/><input name='ton' size='15' maxlength='200'/><br/><anchor>[确认赠送]<go href='songli.asp?Action=pay3&amp;page="&page&"&amp;fansid="&fansid&"&amp;nid="&nid&"&amp;sid="&sidd&"' method='post'><postfield name=""ton"" value=""$(ton)"" /></go></anchor><br/>"
title="<card title=""购买商品""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
book2=""&dao&"<form action=""songli.asp?Action=pay1&amp;nid="&nid&"&amp;sid="&sidd&""" method=""post""><input type=""text"" name=""fansid"" value="""" format=""*N"" size=""15"" maxlength=""200""/><br/><input type=""submit"" value=""确认提交""/></form>"&we0&""
book=""&dao&"<form action=""songli.asp?Action=pay2&amp;sid="&sidd&"&amp;fansid="&fansid&"&amp;nid="&nid&""" method=""post""><input type=""text"" name=""page"" value="""" format=""*N"" size=""4"" maxlength=""5""/>个<input type=""submit"" value=""提交""/></form>"&we0&""
book1=""&dao&"<form action=""songli.asp?Action=pay3&amp;page="&page&"&amp;fansid="&fansid&"&amp;nid="&nid&"&amp;sid="&sidd&""" method=""post"">赠送留言:<br/><input type=""text"" name=""ton"" value="""" size=""15"" maxlength=""200""/><br/><input type=""submit"" value=""确认赠送""/></form>"&we0&""
title="<title>购买商品</title></head><body>"
End Select		
select case Action
case "pay4"
%>
<%=title%><%=qingtian.qingsav("330")%>
<%=dao%><a href="space.asp?sid=<%=sidd%>">我的空间</a>&gt;赠礼物<%=we0%><%=sou%>+请选择好友<%=we0%><%=we%>
<%
	Set Rs = Server.CreateObject("Adodb.Recordset")

	Sql = "select  a.id,a.fansid,b.name,b.online from qingtian_fans a,qingtian_user b  where a.fansid=b.id and a.nid=(select top 1 id from qingtian_user where sid='"&qingtian.Formatsid(sid)&"') order by b.online  desc"
	Rs.Open Sql,conn,1,1


	if not (rs.bof and rs.eof)  then
				Rs.PageSize = 6	'一页N条记录
				IF Not IsEmpty(Page) Then
					IF Not IsNumeric(Page) Then		'判断Page是否为数字
						Page=1
					Else
						Page=Cint(Page)		'转换成短整形Integer
					End IF
					IF Page > Rs.PageCount Then
						Rs.AbsolutePage = Rs.PageCount	'设置当前显示页等于最后一页
					ElseIF Page <= 0 Then
						Rs.AbsolutePage = 1		'设置当前页等于第一页
					Else
						Rs.AbsolutePage = Page	'如果大于零,显示当前页等于接收的页数
					End IF
				Else
					Rs.AbsolutePage = 1
				End IF
				Page = Rs.AbsolutePage
		For i=1 to Rs.PageSize
			If Rs.Eof Then
				exit For
			End If
		if rs("online")=0 then
onlin="不在线"
else
onlin="在线"
end if
%>
[<%=onlin%>]<a href="songli.asp?Action=pay1&amp;fansid=<%=rs("fansid")%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>"><%=qingtian.utf8(rs("name"))%>(<%=rs("fansid")%>)</a><br/>
<%
		Rs.MoveNext
		Next
Response.Write we1
if rs.PageCount >1 then Response.Write(""&dao&"")
       
    		'分页
    		If Page < rs.PageCount Then
    		    Response.Write("<a href='songli.asp?Action=pay4&amp;nid=" &nid& "&amp;page=" & Page + 1 & "&amp;sid="&sidd&"&amp;urls=" & urls & "'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < rs.PageCount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='songli.asp?Action=pay4&amp;nid=" &nid& "&amp;page=" & Page - 1 & "&amp;sid="&sidd&"&amp;urls=" & urls & "'>上一页</a>"&we0&"")
    		Elseif rs.PageCount >1 then
    		    Response.Write(""&we0&"")
Response.Write(""&we&"(第" & Page & "/总" & rs.PageCount & "页/" & rs.RecordCount & "条)"&we0&"")
    		End If
	else
		%>你还没有添加任何好友<%=we0%><%
	end if
	Rs.close
	set rs=nothing


		%>

<%=sou%>+或输入会员ID<%=we0%>
<%=book2%>
<%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay1"

%>
<%=title%><%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;赠礼物<%=we0%>
<%=we%>你要送出的礼物"<%=name1%>"每个增加魅力<%=zi%><%=zmeili%><%=zi0%>点!<br/>赠送对象:<a href="pay.asp?Action=pay2&amp;page=20&amp;nid=<%=nid%>&amp;sid=<%=sidd%>"><%=name2%></a><br/>我要送<a href="songli.asp?Action=pay2&amp;fansid=<%=fansid%>&amp;page=1&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">1个</a><a href="songli.asp?Action=pay2&amp;fansid=<%=fansid%>&amp;page=<%=pag%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>"><%=pag%>个</a>或输入个数:(最小1个,最多<%=pag%>个)<%=we0%><%=book%><%=we%>你有:<%=zi%><%=pag%>个<%=name1%><%=zi0%><br/>
<a href="viewdaoju.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a>
<%=we0%><%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay2"


Session.Abandon
%>
<%=title%><%=qingtian.qingsav("330")%>
<%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;赠礼物<%=we0%>
<%=we%>请确认你要赠送<%=page%>个"<%=name1%>"!<%=we0%><%=book1%><%=we%>你有:<%=zi%><%=mzf0%><%=bi%><%=zi0%><a href="chongzhi.asp?sid=<%=sidd%>">充值</a><br/>马上<a href="chongzhi.asp?sid=<%=sidd%>">充值我的<%=qingtian.bit%></a><br/>
<a href="pay.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay3"
dim Rs_1,Sql_1,name3,ton
        name3=session("username")
        ton=Request.form("ton")
        ton=qingtian.repsql(ton)
        if ton="" then ton="礼轻情意重,小小意思不成敬意!"

%>
<%=title%><%=qingtian.qingsav("330")%><%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;赠礼物<%=we0%>
<%
if clng(pag)>=clng(page) then
if session("tr")=1 then
%>
<%=we%>赠送失败,请不要重复刷新!<br/>
<a href="songli.asp?Action=pay1&amp;fansid=<%=fansid%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%   
else
conn.execute("update qingtian_user set [meili]="&meili+page*zmeili&" where id="&fansid&"")
conn.execute("update qingtian_chuwu set [page]="&clng(pag)-page&" where bid="&tid&" and nid="&nid&"")
Set Rs_1 = Server.CreateObject("Adodb.Recordset")
Sql_1 = "select namea,nameb,toname,toid,aid,bid,topic,tos,ton,meisu from qingtian_daoju"
		Rs_1.Open Sql_1,conn,1,3
			rs_1.addnew
			rs_1("namea")=name2
			rs_1("nameb")=name3
			rs_1("toname")=name1
			rs_1("toid")=clng(nid)
			rs_1("aid")=clng(fansid)
			rs_1("bid")=clng(tid)
			rs_1("topic")=topic
			rs_1("tos")=page
			rs_1("ton")=ton
			rs_1("meisu")=page*clng(zmeili)
			rs_1.update
		Rs_1.close
             set Rs_1=nothing
qingtian.addong("将"&page&"个"&name1&"[img]"&topic&"[/img]赠送给[url=/user/spacev.asp?nid="&fansid&"&urls=/user/ininfo.asp&sid=[sid]]"&name2&"[/url]")
str=""&fansid&"tt你好,你的朋友(url=/user/spacev.asp?nid="&tid&"&urls=/user/ininfo.asp&sid=[sid])"&name3&"(/url)赠送给你"&page&"个(url=/user/viewdaoju.asp?urls="&urls&"&nid="&nid&"&sid=[sid])"&name1&"(/url)[img]"&topic&"[/img],你的魅力增加"&page*zmeili&"点.(url=/user/chuwu.asp?Act=1&fansid="&tid&"&sid=[sid])回赠(/url)"
qingtian.addnfo(str)
session("tr")=1
%>
<%=we%>恭喜你以成功将<%=page%>个<%=name1%>赠送给<%=name2%>,对方增加魅力<%=page*zmeili%>点!<br/>你现在还剩余<%=zi%><%=pag-page%>个<%=name1%><%=zi0%><br/><a href="songli.asp?fansid=<%=fansid%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">继续返回赠送</a><%=we0%><%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<% 
end if  
else
%>
<%=we%><%=we0%>
<%=we%>赠送出错!你的<%=name1%>不足!<br/>你现在的<%=name1%>为:<%=zi%><%=pag%><%=bi%><%=zi0%><br/>马上<a href="chongzhi.asp?sid=<%=sidd%>">充值我的<%=qingtian.bit%></a><br/>
<a href="songli.asp?fansid=<%=fansid%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("331")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<% 
end if 

End Select
else
Response.Redirect "/login.asp?sid=" & sidd & "&url=/user/songli.asp?sid="&sidd&"@@nid="&nid
end if		
end Function
%>
